<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改获奖名单')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-prize-edit" th:object="${actPrize}">
            <input name="id" th:field="*{id}" type="hidden">
            <input id="curDeptId" name="curDeptId" type="hidden" th:value="${curDeptId}"   />
            <input id="schoolId" name="schoolId" th:field="*{schoolId}" type="hidden"   />
            <input id="facultyId" name="facultyId" th:field="*{facultyId}" type="hidden"  />
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">学校：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input class="form-control" type="text" onclick="selectSchool()" id="school" name="school" readonly="true" th:value="*{school}" required>
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">院系：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input class="form-control" type="text" onclick="selectFaculty()" id="faculty" name="faculty" readonly="true" th:value="*{faculty}" required>
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label  is-required">大赛名称：</label>
                <div class="col-sm-8">
                    <input id="gameId" name="gameId" th:field="*{gameId}" type="hidden"   />
                    <input name="gameName" th:field="*{gameName}" class="form-control" type="text" readonly>
                </div>
            </div>


            <div class="form-group">
                <label class="col-sm-3 control-label is-required">作品类别：</label>
                <div class="col-sm-8">
                    <input name="categoryName" th:field="*{categoryName}" class="form-control" type="text" readonly required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">命题名称：</label>
                <div class="col-sm-8">
                    <input name="title" th:field="*{title}" class="form-control" type="text" readonly required>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label is-required">参赛编号：</label>
                <div class="col-sm-8">
                    <input name="actNo" th:field="*{actNo}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">作品名称：</label>
                <div class="col-sm-8">
                    <textarea name="actName" class="form-control" required>[[*{actName}]]</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">作者：</label>
                <div class="col-sm-8">
                    <input name="author" th:field="*{author}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">作者电话：</label>
                <div class="col-sm-8">
                    <input name="authorPhone" th:field="*{authorPhone}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">指导老师：</label>
                <div class="col-sm-8">
                    <input name="teacher" th:field="*{teacher}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">指导老师电话：</label>
                <div class="col-sm-8">
                    <input name="teacherPhone" th:field="*{teacherPhone}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">专业：</label>
                <div class="col-sm-8">
                    <input name="major" th:field="*{major}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">其他：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">获奖等级：</label>
                <div class="col-sm-8">
                    <select id="prizeLevel" name="prizeLevel" class="form-control" th:with="prizeLevels=${prizeLevels}" required>
                        <option th:each="prizeLevel : ${prizeLevels}" th:text="${prizeLevel}" th:value="${prizeLevel}" th:field="*{prizeLevel}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">报送全国总评审：</label>
                <div class="col-sm-8">
                    <select id="sendAudit" name="sendAudit" class="form-control" th:with="sendAudits=${sendAudits}">
                        <option th:each="sendAudit : ${sendAudits}" th:text="${sendAudit}" th:value="${sendAudit}" th:field="*{sendAudit}"></option>
                    </select>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/prize";
        $("#form-prize-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-prize-edit').serialize());
            }
        }

        /*选择学校-选择父部门树*/
        function selectSchool() {
            var curDeptId = $("#curDeptId").val();
            var prefix = ctx + "system/dept";
            var options = {
                title: '学校选择',
                width: "380",
                url: prefix + "/selectDeptTree/" + curDeptId,
                callBack: doSubmitSchool
            };
            $.modal.openOptions(options);
        }

        function doSubmitSchool(index, layero){
            var body = $.modal.getChildFrame(index);
            $("#schoolId").val(body.find('#treeId').val());
            $("#school").val(body.find('#treeName').val());
            $.modal.close(index);
        }


        /*选择院系-选择父部门树*/
        function selectFaculty() {
            var hasPermission = $("#hasPermission").val();;
            //if(hasPermission == 'false'){return;}
            var curDeptId = $("#curDeptId").val();
            var prefix = ctx + "system/dept";
            var options = {
                title: '院系选择',
                width: "380",
                url: prefix + "/selectDeptTree/" + curDeptId,
                callBack: doSubmitFaculty
            };
            $.modal.openOptions(options);
        }

        function doSubmitFaculty(index, layero){
            var body = $.modal.getChildFrame(index);
            $("#facultyId").val(body.find('#treeId').val());
            $("#faculty").val(body.find('#treeName').val());
            $.modal.close(index);
        }
    </script>
</body>
</html>
